﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Core;
using Data;
using Model;
using System.Web.Security;

namespace Web.Controllers
{
    public class HomeController : BaseController
    {
        public ActionResult Index() {
            sys_menuService menuService = new sys_menuService();
            var list = menuService.GetModels(ParamQuery.Instance().AddWhere(" And state <> 2").SetOrderBy("sequence"));
            var model = new {
                menus = list,
                form = new {
                    user_name = Commons.User.user_name,
                    datetime = Commons.ServerDateTime
                }
            };
            return View(model);
        }

        public JsonResult SignOut() {
            FormsAuthentication.SignOut();
            return Json(new { status = "success" }, JsonRequestBehavior.AllowGet);
        }
    }
}
